ARG GRAFANA_VERSION

FROM grafana/grafana:${GRAFANA_VERSION}

ARG GF_INSTALL_PLUGINS=${GF_INSTALL_PLUGINS}
RUN env
RUN if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then \
    OLDIFS=$IFS; \
        IFS=','; \
    for plugin in ${GF_INSTALL_PLUGINS}; do \
        IFS=$OLDIFS; \
        grafana-cli --pluginsDir "$GF_PATHS_PLUGINS" plugins install ${plugin}; \
    done; \
fi

COPY ./provisioning /etc/grafana/provisioning

COPY ./grafana.ini /etc/grafana/grafana.ini

COPY ./dashboards /var/lib/grafana/dashboards

